import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [{
        path: '/',
        name: 'Layout',
        component: () => import('@/views/Layout'),
        children: [{
                path: '/',
                component: () => import('@/views/home')
            },
            {
                path: '/category/:id',
                component: () => import('@/views/category/index.vue')
            },
            {
                path: '/category/sub/:id',
                component: () => import('@/views/category/sub')
            },
            {
                path: '/product/:id',
                component: () => import('@/views/goods/index.vue')
            }
        ]
    },
    // {
    //     path: '/test',
    //     name: 'Test',
    //     component: () => import('@/views/Test')
    // },
]

const router = createRouter({
    history: createWebHashHistory(),
    routes,
    scrollBehavior() {
        return {
            top: 0,
            left: 0
        }
    }
})

export default router